﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushJScript.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushCSharp.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushXml.js"></script>
    <link type="text/css" rel="stylesheet" href="../../Content/highlighter/styles/shCore.css" />
    <link type="text/css" rel="stylesheet" href="../../Content/highlighter/styles/shCoreEclipse.css" />
    <script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
    <h3>如何使用Ajax请求</h3>
    <b>Url.js介绍</b>
    <p>当宿主项目启动时，会在网站根目录生成Scripts目录，并在目录下生成Url.js文件：</p>
    <pre class="brush:javascript;">
        function StringFormat() {
            if (arguments.length == 0)
                return null;
            var str = arguments[0];
            for (var i = 1; i < arguments.length; i++) {
                var re = new RegExp('\\{' + (i - 1) + '\\}', 'gm');
                str = str.replace(re, arguments[i]);
            }
            return str;
        }
        var Url={
            "NFinalCorePlug_Controllers_IndexController":{
                "Default":function()
                {
                    return "/Index/Default.html";
                }
                ,
                "Ajax":function()
                {
                    return "/Index/Ajax.html";
                }
            }
        };
    </pre>
    <b>调用Url.js实现Ajax请求</b>
    <pre>
        $.get(Url.NFinalCorePlug_Controllers_IndexController.Ajax(),{},function(data){
            alert(JSON.stringify(data));
        });
    </pre>
</body>
</html>